-
Notifications
You must be signed in to change notification settings - Fork 680
Python: Fix OpenAI Responses API TextReasoningContent handling
#1330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Python: Fix OpenAI Responses API TextReasoningContent handling
#1330
Conversation
TextReasoningContent handlingTextReasoningContent handling
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
|
Thanks @KanchiShimono this works great! |
|
@mattgotteiner It seems that the Windows test workflow is failing due to a timeout while installing |
|
@KanchiShimono Thanks for your contribution! In this PR: #1509, I skipped I already pulled latest changes from main in this PR, so please check the latest changes and see if |
|
@dmytrostruk Thank you for your reply. The Input schema violation (400 error) no longer occurs. It seems that when the model's final response is a Function Call, we should send
In the gpt-oss Responses API server implementation, the It might be good to support passing |
Motivation and Context
This PR fixes issues when
TextReasoningContentinChatMessageis converted to OpenAI Responses APIinputformat.Two distinct problems:
Input schema violation (400 error)
_openai_content_parserconvertsTextReasoningContentincorrectly for Responses APIinputsummarymust be array format, not objectTextReasoningContentmust be placed at message level, not insidecontentarrayReproduction code and error
Duplicate streaming content
_create_streaming_response_contenthandles bothresponse.reasoning_summary_text.deltaand.doneevents.donecontains complete text already streamed via.delta, causing duplicationDescription
Fixes:
_openai_content_parser:summaryfrom object to array formatTextReasoningContentat correct hierarchy_create_streaming_response_content:casestatement withpassto intentionally ignore.doneeventTests:
summaryschema.doneevent is intentionally ignored (prevents regression)Contribution Checklist